import java.util.Scanner;

// HJ22 汽水瓶
public class HJ22 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String str = sc.nextLine();
            Integer num = Integer.valueOf(str);
            if (num != 0) {
                System.out.println(new HJ22().method(0, num));
            }
        }
    }

    public int method(int sum, int num) {
        if (num >= 3) {
            sum += num / 3;
            num = (num % 3) + (num / 3) ;
            return method(sum, num);
        } else if (num == 2) {
            sum += 1;
        }
        return sum;
    }
}
